
# coding: utf-8

# In[1]:


import numpy as np


# In[2]:


#生产学生成绩
score = np.random.randint(0,151,size= (6,50,3))


# In[4]:


#2.将六个班的考试成绩进行合并得到score
score = np.concatenate(score)


# In[20]:


#3.生成性别数组sex，水平叠加数组sex和score得到data
sex = np.random.randint(0,2,(300,1))


# In[23]:


data= np.hstack((sex,score))


# In[24]:


data


# In[35]:


#统计男女数据
f=np.zeros((0,3))
m=np.zeros((0,3))


# In[36]:


for i in range(0,300):
    if data[i,0]==0:
        f=np.append(f,[data[i,1:]],axis=0)
    if data[i,0]==1:
        m=np.append(m,[data[i,1:]],axis=0)


# In[44]:


f.min


# In[55]:


print("女孩成绩:"+"\t"+"python"+"\t" + "数学"+"\t"+"英语")
print("最小值:"+"\t"+str(f.min(axis=0)[0])+"\t" +str(f.min(axis=0)[1]) +"\t"+str(f.min(axis=0)[2]))
print("最大值:"+"\t"+str(f.max(axis=0)[0])+"\t" +str(f.max(axis=0)[1]) +"\t"+str(f.max(axis=0)[2]))
print("平均值:"+"\t"+str(round(f.mean(axis=0)[0],1))+"\t" +str(round(f.mean(axis=0)[1],1)) +"\t"+str(round(f.mean(axis=0)[2],1)))
print("中位数:"+"\t"+str(round(np.median(f,axis=0)[0],1))+"\t" +str(round(np.median(f,axis=0)[1],1)) +"\t"+str(round(np.median(f,axis=0)[2],1)))
print("标准差:"+"\t"+str(round(f.std(axis=0)[0],1))+"\t" +str(round(f.std(axis=0)[1],1)) +"\t"+str(round(f.std(axis=0)[2],1)))


# In[57]:


print("男孩成绩:"+"python"+"\t" + "数学"+"\t"+"英语")
print("最小值:"+"\t"+str(m.min(axis=0)[0])+"\t" +str(m.min(axis=0)[1]) +"\t"+str(m.min(axis=0)[2]))
print("最大值:"+"\t"+str(m.max(axis=0)[0])+"\t" +str(m.max(axis=0)[1]) +"\t"+str(m.max(axis=0)[2]))
print("平均值:"+"\t"+str(round(m.mean(axis=0)[0],1))+"\t" +str(round(m.mean(axis=0)[1],1)) +"\t"+str(round(m.mean(axis=0)[2],1)))
print("中位数:"+"\t"+str(round(np.median(m,axis=0)[0],1))+"\t" +str(round(np.median(m,axis=0)[1],1)) +"\t"+str(round(np.median(m,axis=0)[2],1)))
print("标准差:"+"\t"+str(round(m.std(axis=0)[0],1))+"\t" +str(round(m.std(axis=0)[1],1)) +"\t"+str(round(m.std(axis=0)[2],1)))

